package com.pattern.design.designpattern.Yuanxing;

import com.pattern.design.designpattern.MainActivity;

import java.util.ArrayList;

/**
 * author:harisucici on 2018/10/9 10:20
 * email:harisucici@gmail.com
 * name:
 * todo:
 */
public class WordDocument implements Cloneable{
    private String mTest;
    private ArrayList<String> mImages = new ArrayList<>(2);

    /**
     * Gets test.
     *
     * @return the test
     */
    public String getTest() {
        return mTest;
    }

    /**
     * Sets test.
     *
     * @param mTest the m test
     */
    public void setTest(String mTest) {
        this.mTest = mTest;
    }

    /**
     * Gets images.
     *
     * @return the images
     */
    public ArrayList<String> getImages() {
        return mImages;
    }

    /**
     * Add images.
     *
     * @param img the img
     */
    public void addImages(String img) {
        this.mImages.add(img);
    }

    /**
     * Instantiates a new Word document.
     */
    public WordDocument(){
    }
    @Override
    public WordDocument clone(){
        try{
            WordDocument document = (WordDocument)super.clone();
            document.mTest = this.mTest;
            //深拷贝
            document.mImages = (ArrayList<String>) this.mImages.clone();
            return document;
        }catch (Exception e){}
        return null;
    }

    /**
     * Show document.
     */
    public void showDocument(){
        MainActivity.systemOut(mTest+mImages.toString());

    }
}
